home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / pcxkt3.zip / SHOWVGA.PAS < prev   
Pascal/Delphi Source File  |  1991-12-31  |  2KB  |  54 lines

  1. program SHOWVGA;
  2.  
  3. (* Sample implementation of PCX.TPU for VGA 16-color files. You need to
  4.    have the Turbo .BGI files in the current directory, or change the
  5.    Initgraph path. Enter a filename (without extension) on the command line
  6.    or, if running under Turbo, in the Parameters box. *)
  7.  
  8. uses GRAPH, DOS, CRT, PCX;
  9.  
  10. var   slot, grdriver, grmode: integer;
  11.  
  12. (* --------------------------------------------------------------------- *)
  13.  
  14. procedure VIDEO_DISABLE(off: boolean);
  15.  
  16. (* Because an extra display page is not always available in VGA modes,
  17.    we can't use SetVisualPage to hide the image while it is being written
  18.    to the screen and the colors are being altered. Instead we can get BIOS
  19.    to turn off the screen. This method has the added advantage of speeding
  20.    up the writing of the image to display memory. Note that the function is
  21.    not available on EGA cards. *)
  22.  
  23. var   regs: registers;
  24.  
  25. begin
  26. regs.ah:= $12;          { BIOS function }
  27. regs.al:= ord(off);     { 0 = on, 1 = off }
  28. regs.bl:= $36;          { Subfunction }
  29. intr($10, regs);        { Call BIOS }
  30. end;
  31.  
  32. (* --------------------------------------------------------------------- *)
  33.  
  34. begin    { SHOWVGA }
  35. pcxfilename:= paramstr(1) + '.PCX';
  36. grdriver:= vga; grmode:= vgahi;               { 640x480x16 format }
  37. initgraph(grdriver, grmode, '');
  38. video_disable(true);
  39. read_pcx_file(grdriver, pcxfilename);
  40. if file_error then
  41. begin
  42.   closegraph;
  43.   writeln('File ', fexpand(pcxfilename), ' not found.');
  44.   halt;
  45. end;
  46. for slot:= 0 to 15 do                            { Alter the registers }
  47.   with RGBpal[slot] do
  48.   setRGBpalette(slot, redval, greenval, blueval);
  49. setallpalette(pal);                              { Point to registers 0-15 }
  50. video_disable(false);                            { Turn on video }
  51. repeat until readkey <> #1;
  52. closegraph;
  53. end.
  54.